<template>
  <el-form :model="modelValue" ref="formRef" label-width="80px">
    <el-form-item label="姓名" prop="name" :rules="[{ required: true, message: '请输入姓名' }]">
      <el-input v-model="modelValue.name"/>
    </el-form-item>
    <el-form-item label="电话" prop="phone" :rules="[{ required: true, message: '请输入电话' }]">
      <el-input v-model="modelValue.phone"/>
    </el-form-item>
    <el-form-item label="地址" prop="address" :rules="[{ required: true, message: '请输入地址' }]">
      <el-input v-model="modelValue.address"/>
    </el-form-item>
    <el-button type="primary" @click="handleNext">下一步</el-button>
  </el-form>
</template>

<script setup>
import { ref } from 'vue'
const props = defineProps(['modelValue'])
const emit = defineEmits(['update:modelValue', 'next'])
const formRef = ref(null)

function handleNext() {
  formRef.value.validate((valid) => {
    if (valid) emit('next')
  })
}
</script> 